cmake_minimum_required(VERSION 3.15)
project(lidar_2d)

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  set(CMAKE_BUILD_TYPE Release)
endif()

set(CMAKE_CXX_STANDARD 17)

find_package(rclcpp REQUIRED)
find_package(rclpy REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(Eigen3 REQUIRED)

message(STATUS "Found Eigen3: ${EIGEN3_INCLUDE_DIR}")

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/src
  ${EIGEN3_INCLUDE_DIR}
)

file(GLOB_RECURSE ALL_MAPPING_2D_SRCS "src/*.cpp")

add_executable(map_builder src/mapping/2d/map_builder.cpp ${ALL_MAPPING_2D_SRCS})
ament_target_dependencies(map_builder rclcpp rclpy sensor_msgs nav_msgs)

install(
  DIRECTORY launch
  DESTINATION share/${PROJECT_NAME}/
)

install(
  DIRECTORY config
  DESTINATION share/${PROJECT_NAME}/
)

install(
  TARGETS map_builder
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()